#include "Entity.h"
#include "SpriteSystem.h"
#include "CollisionSystem.h"
// INCLUDE ALL SYSTEMS HERE
using namespace fe;

Entity::Entity()
{
    for(int i = 0; i < Component::Max; i++)
    {
        m_component[i] = NULL;
    }
}

Entity::~Entity()
{
    for(int i = 0; i < Component::Max; i++)
    {
        if(m_component[i])
            delete m_component[i];
    }
}

void Entity::addComponent(Component::TYPE type, Component* comp)
{
    m_component[type] = comp;
    m_component[type]->setEntity(this);

    if(type == Component::Sprite)
    {
        SpriteSystem::getInst()->addComponent((Sprite*)m_component[type]);
    }
    else if(type == Component::Collision)
    {
        CollisionSystem::getInst()->addComponent((Collision*)m_component[type]);
    }
}

